<%--
  Created by IntelliJ IDEA.
  User: Squking
  Date: 2018/5/8
  Time: 23:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>浏览图书</title>
</head>

<body>
<table border="1" cellpadding="10" cellspacing="0">
    <tr>
        <th>封面</th>
        <th>ISBN</th>
        <th>图书名称</th>
        <th>作者</th>
        <th>价格</th>
        <th>出版社</th>
        <th></th>
    </tr>

    <c:forEach items="${listBook }" var="book">
        <tr>
            <td>${book.picture }</td>
            <td>${book.ISBN }</td>
            <td>${book.name }</td>
            <td>${book.author }</td>
            <td>${book.price }</td>
            <td>${book.publish }</td>
            <td>
                <form action="/action/addToCart/${book.ISBN}" method="post">
                    <input type="submit" value="加入购物车" />
                </form>
            </td>
        </tr>
    </c:forEach>
</table>
<c:if test="${page>0}">
    <a href="/showBooks/${page-1}">上一页</a>
</c:if>
<c:if test="${page<=0}">
    <a>上一页</a>
</c:if>
<c:if test="${page<totalPage-1}">
    <a href="/showBooks/${page+1}">下一页</a>
</c:if>
<c:if test="${page>=totalPage-1}">
    <a>下一页</a>
</c:if>
<p>当前页: ${page + 1}, 总数: ${totalPage}</p>
<a href="../../index.jsp">返回</a>
</body>
</html>
